<?php
/*
Plugin Name: Bookmarks for TC
Description: Add the Bookmarks to your Entry title
Version: 0.1
Author: Cain Chen, Hinablue.
Author URI: http://hina.ushiisland.net/blog/
*/ 

function ShowBookmarks($target, $mother) {
	global $configVal, $blogid, $suri, $database, $defaultURL, $pluginURL, $blog, $entries;
	$slogan		= ($blog['useSloganOnPost'] || $blog['useSloganOnCategory'] || $blog['useSloganOnTag']) ? (DBQuery::queryCell("SELECT slogan FROM {$database['prefix']}Entries WHERE blogid = {$blogid} AND id = ".$mother)) : (DBQuery::queryCell("SELECT title FROM {$database['prefix']}Entries WHERE blogid = {$blogid} AND id = ".$mother));
	$slogan		= rawurlencode($slogan);
	$bookmark = '';
	if($suri['directive']!="/rss" && $suri['directive']!="/m" && $suri['directive']!="/i/entry" && $suri['directive']!="/atom" && $suri['directive']!="/sync")
	{
		if($suri['directive']!="/category") {
			$permalink	= ($blog['useSloganOnCategory'])?"{$defaultURL}/entry/{$slogan}":"{$defaultURL}/".$mother;
		} elseif($suri['directive']!="/tag") {
			$permalink	= ($blog['useSloganOnTag'])?"{$defaultURL}/entry/{$slogan}":"{$defaultURL}/".$mother;
		} else {
			$permalink	= ($blog['useSloganOnPost'])?"{$defaultURL}/entry/{$slogan}":"{$defaultURL}/".$mother;
		}
		$bookmark = <<<EOF
	<div class="bookmarkInfo">
		<fieldset style="margin:20px 0px 20px 0px;padding:5px;border:1px solid #efefef;">
		<legend><strong>Bookmarks</strong></legend>
			<span><img src="{$pluginURL}/hemidemi.gif" />&nbsp;<a href="http://www.hemidemi.com/user_bookmark/new?url={$permalink}&title={$slogan}" target="_blank">HEMiDEMi</a></span>&nbsp;<span><img src="{$pluginURL}/technorati.gif" />&nbsp;<a href="http://technorati.com/faves?add={$permalink}" target="_blank">Technorati</a></span>&nbsp;<span><img src="{$pluginURL}/delicious.gif" />&nbsp;<a href="http://del.icio.us/post?url={$permalink}&title={$slogan}" target="_blank">Del.icio.us</a></span>&nbsp;<span><img src="{$pluginURL}/digman.gif" />&nbsp;<a href="http://digg.com/submit?phase=2&url={$permalink}" target="_blank">Digg</a></span>&nbsp;<span><img src="{$pluginURL}/funP.gif" />&nbsp;<a href="http://funp.com/pages/submit/add.php?url={$permalink}" target="_blank">funP</a></span>&nbsp;<span><img src="{$pluginURL}/yahoo.gif" />&nbsp;<a href="http://tw.myweb2.search.yahoo.com/myresults/bookmarklet?u={$permalink}&ei=UTF-8&t={$slogan}" target="_blank">Yahoo!</a></span>&nbsp;<span><img src="{$pluginURL}/furl.jpg" />&nbsp;<a href="http://www.furl.net/storeIt.jsp?u={$permalink}&t={$slogan}" target="_blank">Furl</a></span>
		</fieldset>
	</div>
EOF;
	}
	return $target.$bookmark;
}

?>